package cn.superchart.module.uerole.controller;

import cn.superchart.common.base.BaseController;
import cn.superchart.common.base.BaseResult;
import cn.superchart.module.uerole.param.ScUserRoleAddParam;
import cn.superchart.module.uerole.param.ScUserRoleDetailParam;
import cn.superchart.module.uerole.param.ScUserRoleEditParam;
import cn.superchart.module.uerole.param.ScUserRoleIdParam;
import cn.superchart.module.uerole.service.ScUserRoleService;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Validated
public class ScUserRoleController extends BaseController<ScUserRoleService> {


    @PostMapping("/sc/uerole/add")
    public BaseResult<String> add(@RequestBody @Valid ScUserRoleAddParam scUserRoleAddParam) {
        service.add(scUserRoleAddParam);
        return BaseResult.ok();
    }

    @PostMapping("/sc/uerole/edit")
    public BaseResult<String> edit(@RequestBody @Valid ScUserRoleEditParam scUserRoleEditParam) {
        service.edit(scUserRoleEditParam);
        return BaseResult.ok();
    }

    @GetMapping("/sc/uerole/detail")
    public BaseResult<ScUserRoleDetailParam> detail(@Valid ScUserRoleIdParam scUserRoleIdParam) {
        return BaseResult.result(service.detail(scUserRoleIdParam.getId()));
    }
}
